/*	
 *				
 *					ISNW ---- It is a war.It is not warcraft!
 *
 *
 *					Author:					zhoukeli(haxixi_keli)
 *					Filename:				isnwVertex.h
 *					CreateTime:				2008/12/17
 *					ModifyTime:				2008/12/17
 *
 */

#ifndef __ISNW_VERTEX_H__
#define __ISNW_VERTEX_H__

#include "isnwTypes.h"
#include "vector3d.h"
#include "isnwColor.h"
#include "vector2d.h"

namespace ISNW
{
namespace video
{
	enum E_VERTEX_TYPE
	{
		STANDAND_VERTEX,	// standand vertex
		TWOTCOORDS_VERTEX,	// vertex with 2 texture coords
	};
	class vertex
	{
	//! members
	public:
		//! position
		core::vector3df	pos;

		//! normal
		core::vector3df normal;

		//! color
		video::color32	color;

		//! texture coords
		core::vector2df	coords;

	//! constructor
	public:
		//! default constructor
		vertex(){}
		//! copy constructor
		vertex(const core::vector3df& p,const core::vector3df& n,const video::color32& c,const core::vector2df& coord)
			:pos(p),normal(n),color(c),coords(coord){}
		//! copy constructor
		vertex(f32 x,f32 y,f32 z,f32 nx,f32 ny,f32 nz,u32 r,u32 g,u32 b,u32 a,f32 tu,f32 tv)
			:pos(x,y,z),normal(nx,ny,nz),color(r,g,b,a),coords(tu,tv){}

	//! operators
	public:
		vertex& operator = (const vertex& other)
		{
			pos = other.pos;
			normal = other.normal;
			color = other.color;
			coords = other.coords;

			return *this;
		}

		bool operator == (const vertex& other) const
		{
			return	(pos == other.pos) && 
					(normal == other.normal) && 
					(color == other.color) && 
					(coords == other.coords);
		}
	
		bool operator != (const vertex& other) const
		{
			return !(*this == other);
		}
	};

	class vertex2tcoords
	{
	public:
		core::vector3df pos;

		core::vector3df normal;

		video::color32	color;

		core::vector2df coord1;

		core::vector2df coord2;

	public:
		vertex2tcoords(){}
		
		vertex2tcoords(core::vector3df position,core::vector3df norm,video::color32 c,core::vector2df c1,core::vector2df c2)
			:pos(position),normal(norm),color(c),coord1(c1),coord2(c2){}

		vertex2tcoords(const vertex2tcoords& other){*this = other;}

	public:
		vertex2tcoords& operator = (const vertex2tcoords& other)
		{
			pos = other.pos;
			color = other.color;
			normal = other.normal;
			coord1 = other.coord1;
			coord2 = other.coord2;

			return *this;
		}

		bool operator == (const vertex2tcoords& other)
		{
			return (pos == other.pos) &&
				   (normal == other.normal) &&
				   (color == other.color) &&
				   (coord1 == other.coord1) &&
				   (coord2 == other.coord2);
		}

		bool operator != (const vertex2tcoords& other)
		{
			return !(*this == other);
		}
	};

} // end namespace video
} // end namespace ISNW
#endif